import kotlinx.coroutines.*

fun main()= runBlocking {
    launch {
        //delay(1000)
        println("world")
        println("launch:"+Thread.currentThread().name)
    }
    coroutineScope {
        launch {
            //delay(500)
            println("coroutineScope launch ")
        }
        //delay(2000)
        println("coroutineScope")
    }
    println("主线程：" +Thread.currentThread().name+"线程总量："+Thread.activeCount())
    val threadGroup = Thread.currentThread().threadGroup
    val activeCount = Thread.activeCount()
    val threads = arrayOfNulls<Thread>(activeCount)
    threadGroup.enumerate(threads)
    threads.forEach {
        println("遍历的线程："+ it?.name)
    }
}

